package com.laogao.lesson084.article;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <b>description</b>： Java进阶、性能优化实战案例100讲，微信公众号:程序员恰恰，源码 & 文档 & 技术支持，请加个人微信号：it3306 <br>
 * <b>time</b>：2025/9/2 20:15 <br>
 * <b>author</b>：ready lao_gao
 */
@Configuration
public class ArticleCheckConfig {

    @Bean
    public ContentLengthCheck1 contentLengthCheck() {
        return new ContentLengthCheck1();
    }

    @Bean
    public SensitiveWordsCheck2 sensitiveWordsCheck() {
        return new SensitiveWordsCheck2();
    }

    @Bean
    public ImageCheck3 imageCheck() {
        return new ImageCheck3();
    }

    @Bean
    public PublishCountCheck4 publishCountCheck() {
        return new PublishCountCheck4();
    }

    /**
     * 责任链
     *
     * @return
     */
    @Bean
    public IArticlePublishCheck articlePublishCheck() {
        ContentLengthCheck1 firstCheck = this.contentLengthCheck();
        firstCheck
                .setNext(this.sensitiveWordsCheck())
                .setNext(this.imageCheck())
                .setNext(this.publishCountCheck())
        ;
        return firstCheck;
    }
}
